var MaterialModel = function (material) {
  BaseModel.call(this);

  var self = this;
  var fn = {
    initData: function (material) {
      var fields = ['materialName', 'adJustInCount', 'adJustInPrice'];
      self.setDataFromObj(material, fields);

      self.id = SysUtil.getId();
    }
  };

  this.getObject = function () {
    var adJustInCount = this.adJustInCount;
    if (adJustInCount === undefined) {
      adJustInCount = 0;
    }
    var adJustInPrice = this.adJustInPrice;
    if (adJustInPrice === undefined) {
      adJustInPrice = 0;
    }

    if (adJustInCount === 0 && adJustInPrice === 0) {
      return null;
    }

    return {
      materialName: this.materialName,
      adJustInCount: adJustInCount,
      adJustInPrice: adJustInPrice
    };
  };

  fn.initData(material)
};
